]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
keyboard: Handle no-window case in FocusTracker
authorFlorian Müllner <fmuellner@gnome.org>
Mon, 16 Jul 2018 23:36:38 +0000 (01:36 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 16 Jul 2018 23:44:18 +0000 (01:44 +0200)
For windows, the cursor location needs to be adjusted by the frame
offsets. However we cannot assume that there is a window, as the
shell itself can have the key focus.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/414

js/ui/keyboard.js

index 41942eeaa22eefc80e19d97b06aff2aa199ed200..1fefb8c6ca91cf18ea76caf2eaf9e44cd0fc58ce 100644 (file)
@@ -533,17 +533,25 @@ var FocusTracker = new Lang.Class({
     },
 
     _setCurrentRect(rect) {
-        let frameRect = this._currentWindow.get_frame_rect();
-        rect.x -= frameRect.x;
-        rect.y -= frameRect.y;
+        if (this._currentWindow) {
+            let frameRect = this._currentWindow.get_frame_rect();
+            rect.x -= frameRect.x;
+            rect.y -= frameRect.y;
+        }
 
         this._rect = rect;
         this.emit('position-changed');
     },
 
     getCurrentRect() {
-        let frameRect = this._currentWindow.get_frame_rect();
-        let rect = { x: this._rect.x + frameRect.x, y: this._rect.y + frameRect.y, width: this._rect.width, height: this._rect.height };
+        let rect = { x: this._rect.x, y: this._rect.y,
+                     width: this._rect.width, height: this._rect.height };
+
+        if (this._currentWindow) {
+            let frameRect = this._currentWindow.get_frame_rect();
+            rect.x += frameRect.x;
+            rect.y += frameRect.y;
+        }
 
         return rect;
     }